Is there any way to get a DXL script to run in the background, and allow you to do other tasks while it is running?
I am trying to make a little dialog box that will run in the background, show the current time (like a running clock), and automatically log the user off at a certain time.
You can set up a loop that constantly checks the current time against some time limit, but you can't do anything else while the loop is running (which defeats the purpose). All other DOORS windows are inactive while DXL is running.
I am not aware of any way to kick off a callback function and continue on with the rest of the DXL script.
djakad - Wed Mar 25 12:06:39 EDT 2009 |
|
Re: Can you get a DXL script to run "in the background" ? kbmurphy - Wed Mar 25 12:51:18 EDT 2009
There are people more technical in DOORS than I am, but I'm going to give you my layman answer.
No.
Here's a secret: DOORS is DXL. And DOORS is single-threaded. This means that for all intents and purposes, DOORS can only do one thing at a time.
|
|
Re: Can you get a DXL script to run "in the background" ? DXLNeed - Thu Mar 26 05:22:53 EDT 2009
You can run a DXL code in background, but you can not have any dialog box in that DXL file.
Also you want user to work on parallely then you have to make sure that the background DXL should not touch any item which can be user by the user in active mode.
|
|
Re: Can you get a DXL script to run "in the background" ? Tony_Goodman - Thu Mar 26 05:54:17 EDT 2009 DXLNeed - Thu Mar 26 05:22:53 EDT 2009
You can run a DXL code in background, but you can not have any dialog box in that DXL file.
Also you want user to work on parallely then you have to make sure that the background DXL should not touch any item which can be user by the user in active mode.
The following code implements a non-blocking dialog that shows a digital clock. It uses the timer() perm that was introduced in DOORS 8.2.
This continues to run while the user can do other things, although you will notice that the clock is not updated in real time if DOORS gets busy when opening a module for example.
// How to use a timer on a dialog.
/*
First stab at using undocumented timer perms.
Displays the curent time which is updated every second.
Buttons demonstrate how to stop and restart the timer.
This is really good news for my Tetris for DOORS script
because I will be able to make the shapes fall on their own!!!
Requires DOORS 8.2.
Tony Goodman Smart DXL Limited.
*/
DB db = null
DBE dbeClock = null
DBE dbeTime = null
DBE dbeStart = null
DBE dbeStop = null
int interval = 1
// callback on timer updates the display
void doClock(DBE dbe)
{
string s = stringOf(dateAndTime(today))
set(dbeTime, s11:)
}
// start the clock
void doStart(DB db)
{
if (startTimer(dbeClock))
{
inactive(dbeStart)
active(dbeStop)
}
}
// stop the clock
void doStop(DB db)
{
if (stopTimer(dbeClock))
{
active(dbeStart)
inactive(dbeStop)
}
}
db = create(dbExplorer, "Test", styleCentered)
dbeTime = field(db, "Current time", "", 10, true)
// create the timer. Don't know what string parameter is for.
dbeClock = timer(db, interval, doClock, "")
dbeStart = apply(db, "Start", doStart)
dbeStop = apply(db, "Stop", doStop)
realize db
setCenteredSize(db, 170, 100)
inactive(dbeStart)
show db
|
|
Re: Can you get a DXL script to run "in the background" ? Tony_Goodman - Thu Mar 26 05:56:19 EDT 2009 kbmurphy - Wed Mar 25 12:51:18 EDT 2009
There are people more technical in DOORS than I am, but I'm going to give you my layman answer.
No.
Here's a secret: DOORS is DXL. And DOORS is single-threaded. This means that for all intents and purposes, DOORS can only do one thing at a time.
"DOORS can only do one thing at a time."
I knew DOORS was male and not female.
|
|
Re: Can you get a DXL script to run "in the background" ? llandale - Thu Mar 26 11:27:33 EDT 2009 Tony_Goodman - Thu Mar 26 05:56:19 EDT 2009
"DOORS can only do one thing at a time."
I knew DOORS was male and not female.
He didn't say that DOORS can do one thing very well at a time.
|
|
Re: Can you get a DXL script to run "in the background" ? llandale - Thu Mar 26 11:36:11 EDT 2009
Perhaps you can modify Tony's script as follows: There's a button called "I'm Still Alive" that resets a time out period, perhaps storing the current time in a global variable, StillAliveTime. The Timer callback that fires every minute subtract StillAliveTime from the current time, and if an hour has passed that the user isn't declared to still be alive, saves and closes all modules and exits DOORS. Otherwise, perhaps display on the dialog how many minutes are left before the rude exit commenses.
>Louie
|
|
Re: Can you get a DXL script to run "in the background" ? kbmurphy - Thu Mar 26 12:14:31 EDT 2009 Tony_Goodman - Thu Mar 26 05:54:17 EDT 2009
The following code implements a non-blocking dialog that shows a digital clock. It uses the timer() perm that was introduced in DOORS 8.2.
This continues to run while the user can do other things, although you will notice that the clock is not updated in real time if DOORS gets busy when opening a module for example.
// How to use a timer on a dialog.
/*
First stab at using undocumented timer perms.
Displays the curent time which is updated every second.
Buttons demonstrate how to stop and restart the timer.
This is really good news for my Tetris for DOORS script
because I will be able to make the shapes fall on their own!!!
Requires DOORS 8.2.
Tony Goodman Smart DXL Limited.
*/
DB db = null
DBE dbeClock = null
DBE dbeTime = null
DBE dbeStart = null
DBE dbeStop = null
int interval = 1
// callback on timer updates the display
void doClock(DBE dbe)
{
string s = stringOf(dateAndTime(today))
set(dbeTime, s11:)
}
// start the clock
void doStart(DB db)
{
if (startTimer(dbeClock))
{
inactive(dbeStart)
active(dbeStop)
}
}
// stop the clock
void doStop(DB db)
{
if (stopTimer(dbeClock))
{
active(dbeStart)
inactive(dbeStop)
}
}
db = create(dbExplorer, "Test", styleCentered)
dbeTime = field(db, "Current time", "", 10, true)
// create the timer. Don't know what string parameter is for.
dbeClock = timer(db, interval, doClock, "")
dbeStart = apply(db, "Start", doStart)
dbeStop = apply(db, "Stop", doStop)
realize db
setCenteredSize(db, 170, 100)
inactive(dbeStart)
show db
Well I am amazed that DOORS can run background DXL--though it is an undocumented perm and thus subject to IBM's whims.
I want to say, "DOORS is a (man|woman) because it works," but:
a. I don't want to offend anyone and
b. Some people would argue that DOORS works!
|
|
Re: Can you get a DXL script to run "in the background" ? djakad - Thu Mar 26 12:30:46 EDT 2009 Tony_Goodman - Thu Mar 26 05:56:19 EDT 2009
"DOORS can only do one thing at a time."
I knew DOORS was male and not female.
Tony. Thanks! That should work. You must have done quite a bit of experimenting to figure that out.
I did find that you can also pass in a real, instead of an int, for the interval; however, the timer won't run faster than 0.1 seconds, no matter how small of a number you give it.
I also found you can assign or re-assign the timer callback with set(DBE timer,void(DBE))
|
|
Re: Can you get a DXL script to run "in the background" ? BeastBoysDad - Fri Oct 04 18:49:57 EDT 2013
The timer function referenced above is not documented in the DOORS DXL Reference Manual. I've asked IBM to provide documentation and they declined. I've submitted an RFE to ask IBM to add the timer function to the DXL Reference Manual. Please vote on the proposed RFE at http://www.ibm.com/developerworks/rfe/execute?use_case=viewRfe&CR_ID=39914.
|
|